/*
 *  Copyright 2007 frank.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package org.frv.wispr.web.account;

import javax.swing.tree.TreeNode;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.extensions.markup.html.tree.table.ColumnLocation;
import org.apache.wicket.extensions.markup.html.tree.table.IRenderable;
import org.apache.wicket.extensions.markup.html.tree.table.PropertyRenderableColumn;
import org.apache.wicket.model.PropertyModel;
import org.frv.wispr.web.account.EditableTextFieldPanel;

/**
 *
 * @author frank
 */
class PropertyEditableColumn extends PropertyRenderableColumn {

    public PropertyEditableColumn(ColumnLocation columnLocation, String header, String propertyExpression) {
        super(columnLocation, header, propertyExpression);
    }

    @Override
    public Component newCell(MarkupContainer parent, String id, TreeNode node, int level) {
        return new EditableTextFieldPanel(id, new PropertyModel(node, getPropertyExpression()));
    }


    /**
     * Next stage this will always be null, and newCell will always be involved.  
     */
    @Override
    public IRenderable newCell(TreeNode node, int level) {
        return null;    
    }
}
